

import java.io.IOException;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.fresh.bus.canoe.server.CanoeServer;

public class Main {

	public static void main(String[] args) throws IOException {
		new ClassPathXmlApplicationContext();
		
		def config = ["applicationContext.xml", "services.xml","schdules.xml" ] as String[]
		
		ApplicationContext applicationContext = new ClassPathXmlApplicationContext(config);

		CanoeServer server = (CanoeServer) applicationContext.getBean("server");
		server.start();
		System.out.println("Begin start server...");
		//加入系统退出钩子，以便收到关闭系统命令时，通知客户系统维护
		Runtime.getRuntime().addShutdownHook(new Thread() {
			public void run() {
				System.out.println("in : run () : shutdownHook");
				// save state, resource clean,up etc.
				
				System.out.println("Shutdown hook completed...");
			}});
		
		//UberDao dao = (UberDao) applicationContext.getBean("uberDao");
		//dao.addRatings("测试", "这是测试");

	}
}
